import request from '@/api/Axios/Axios'
import { BaseResponse } from '@/PageData/index'
import { ExamUrl } from '@/utils/BaseUrl/BaseUrl';
import { TrainingUrl } from '@/utils/BaseUrl/BaseUrl';

// 封装 get post 请求
class REQ {
    get<T>(url: string, params?: T): Promise<BaseResponse> {
        return request.get(ExamUrl + url, { params });
    };
    post<T>(url: string, params?: T): Promise<BaseResponse> {
        return request.post(ExamUrl + url, params);
    }
}
// 实例化请求类
const Request = new REQ();

// 封装 get post 请求
class TREQ {
    get<T>(url: string, params?: T): Promise<BaseResponse> {
        return request.get(TrainingUrl + url, { params });
    };
    post<T>(url: string, params?: T): Promise<BaseResponse> {
        return request.post(TrainingUrl + url, params);
    }
}
// 实例化请求类
const TRequest = new TREQ();
//试题模块
export class Question {
    //获取试题
    GetQuestion(params: any) {
        return Request.get('Question/GetQuestion', params);
    }
    //添加试题
    AddQuestion(params: any) {
        return Request.post('Question/AddQuestion', params);
    }
    //删除试题
    DeleteQuestion(params: any) {
        return Request.post('Question/DeleteQuestion', params);
    }
    //获取单个试题
    UpdateEchoQuestion(params: any) {
        return Request.post('Question/UpdateEchoQuestion', params);
    }
    //发布试题
    IsPublishQuestion(params: any) {
        return Request.post('Question/IsPublish', params);
    }
    //禁用试题
    IsBanQuestion(params: any) {
        return Request.post('Question/IsBna', params);
    }
}
//试题模块
export class TaskPaper {
    //获取试卷
    GetTaskPaper(params: any) {
        return Request.get('TestPaper/GetTestPaper', params);
    }
    //随机添加试卷
    ConstituteTaskPaper(params: any) {
        return Request.get('TestPaper/ConstituteTestPage', params);
    }
    //人工统计试卷
    ArtificialTaskPaper(params: any) {
        return Request.get('TestPaper/ArtificialTestPage', params);
    }
    //添加试卷
    AddTaskPaper(params: any) {
        return Request.get('TestPaper/RandomAddTestPage', params);
    }
    //删除试卷
    DeleteTaskPaper(params: any) {
        return Request.post('TestPaper/DeleteTestPaper', params);
    }
    //获取单个试卷
    UpdateEchoTaskPaper(params: any) {
        return Request.get('TestPaper/GetEchoTestPaper', params);
    }
    //修改试卷
    UpdateTaskPaper(params: any) {
        return Request.post('TestPaper/UpdateTestPaper', params);
    }
    //发布试卷
    IsPublishTaskPaper(params: any) {
        return Request.post('TestPaper/IsPublic', params);
    }
    //禁用试卷
    IsBanTaskPaper(params: any) {
        return Request.post('TestPaper/IsBan', params);
    }
}
//题库管理
export class QuestionBank {
    //获取题库
    GetQuestionBank(params: any) {
        return Request.get("TestQuestionBank/GetQuestionBank", params);
    }
    AddQuestionBank(params: any) {
        return Request.post("TestQuestionBank/AddQuestionBank", params);
    }
    DeleteQuestionBank(params: any) {
        return Request.post("TestQuestionBank/DeleteQuestionBank", params);
    }
    GetEchoQuestionBank(params: any) {
        return Request.get("TestQuestionBank/GetEchoQuestionBank", params);
    }
    IsBanQuestionBank(params: any) {
        return Request.post("TestQuestionBank/IsBan", params);
    }
    IsPublishQuestionBank(params: any) {
        return Request.post("TestQuestionBank/IsPublish", params);
    }
    UpdateQuestionBank(params: any) {
        return Request.post("TestQuestionBank/UpdateQuestionBank", params);
    }
    ConstituteJoinQuestion(params: any) {
        return Request.post("TestQuestionBank/ConstituteJoinQuestion", params);
    }
    GetQuestion(params: any) {
        return Request.get("TestQuestionBank/GetQuestion", params);
    }
    ArtificialJoinQuestion(params: any) {
        return Request.post("TestQuestionBank/ArtificialJoinQuestion", params);
    }
    RemoveQuestion(params: any) {
        return Request.post("TestQuestionBank/RemoveQuestion", params);
    }
}
export class GetArranges {
    GetArrange(params: any) {
        return Request.get("Arrange/GetArrange", params);
    }
    AddArrange(params: any) {
        return Request.post("Arrange/AddArrange", params);
    }
    //获取培训班
    GetTraining(params: any) {
        return TRequest.get('TrainTask/GetTraining', params)
    }
    DeleteArrange(params: any) {
        return Request.post("Arrange/DeleteArrange", params);
    }
    GetEchoArrange(params: any) {
        return Request.get("Arrange/GetEchoArrange", params);
    }
    UpdateArrange(params: any) {
        return Request.post("Arrange/UpdateArrange", params);
    }
    ReviewTestpaper(params: any) {
        return Request.post("Arrange/ReviewTestpaper", params);
    }
}
export class Task {
    GetTask(params: any) {
        return Request.get("Task/GetTask", params);
    }
    AddTask(params: any) {
        return Request.post("Task/AddTask", params);
    }
    UpdateEchoTask(params: any) {
        return Request.get("Task/UpdateEchoTask", params);
    }
    UpdateTask(params: any) {
        return Request.post("Task/UpdateTask", params);
    }
    DeleteTask(params: any) {
        return Request.get("Task/DeleteTask", params);
    }
    TaskPaper(params: any) {
        return Request.get("Task/TaskPaper", params);
    }
    QuestionLv(params: any) {
        return Request.get("Task/QuestionLv", params);
    }
}